home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
rjs.lha
/
RJS
/
String
/
src
/
before.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-06-14
|
733b
|
39 lines
#include "String.h"
RJS_SubString RJS_String::before(int pos)
{
return substr(0,pos);
}
RJS_SubString RJS_String::before(char c)
{
int pos=search(&c,1);
if (pos==-1) return substr(-1,0);
else return substr(0,pos);
}
RJS_SubString RJS_String::before(const char *s)
{
int pos=search(s,RJS_String::length(s));
if (pos==-1) return substr(-1,0);
else return substr(0,pos);
}
RJS_SubString RJS_String::before(const RJS_String &s)
{
int pos=search(s.cptr(),s.length());
if (pos==-1) return substr(-1,0);
else return substr(0,pos);
}
RJS_SubString RJS_String::before(const RJS_StringSearch &ss)
{
int ss_len;
int pos=ss.search(*this,ss_len);
if (pos==-1) return substr(-1,0);
else return substr(0,pos);
}